home *** CD-ROM | disk | FTP | other *** search
/ HPAVC / HPAVC CD-ROM.iso / MCASM.RAR / MC_ASM.EXE / WROX_ASM / CH13 / C13_2.TXT < prev    next >
Text File  |  1994-11-23  |  990b  |  52 lines

  1.  
  2. Program 13.2. Allocating memory blocks in upper memory
  3.                     . . .
  4.     ptr1        dw 0
  5.     save_str    dw 0
  6.     link_flag   db 0
  7.     
  8.                     . . .
  9.     
  10.             mov ax,5800h        ; Get allocation strategy
  11.             int 21h
  12.             mov save_str,ax        ; Save it
  13.     
  14.             mov ax,5802h        ; Get link flag
  15.             int 21h
  16.             mov link_flag,al        ; Save it
  17.     
  18.             mov bx,80h        ; New strategy is First-fit-high
  19.             mov ax,5801h        ; Set allocation strategy
  20.             int 21h
  21.             jc bad_strategy
  22.     
  23.             mov bx,1            ; New link flag = on
  24.             mov ax,5803h        ; Set it
  25.             int 21h
  26.             jc link_error
  27.     
  28.             mov bx,625        ; Allocate 625 paragraphs
  29.             mov ah,48h 
  30.             int 21h
  31.             jc alloc_err
  32.             mov ptr1,ax        ; Store new segment address
  33.     
  34.             ; . . .            ; Make use of it...
  35.     
  36.             mov es,ptr1        ; Dispose of it
  37.             mov ah,49h
  38.             int 21h
  39.             jc free_error
  40.     
  41.             mov bx,save_str        ; Restore strategy
  42.             mov ax,5801h
  43.             int 21h
  44.             jc bad_strategy
  45.     
  46.             mov ax,5803h        ; Restore link flag
  47.             xor bx,bx
  48.             mov bl,link_flag
  49.             int 21h
  50.             jc link_error
  51.  
  52.